function rtrim(str, chars) { 
	chars = chars || "\\s"; 
	return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); 
}
